package com.ruoyi.ruo.file.controller;

import com.ruoyi.common.core.exception.file.InvalidExtensionException;
import com.ruoyi.ruo.file.service.FileUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping(("/web/file"))
public class FileUploadController {

    @Autowired
    FileUploadService fileUploadService;

    @PostMapping("/upload")
    public String upload(MultipartFile file) throws IOException, InvalidExtensionException {
        String path=fileUploadService.upload(file);
        return path;
    }



}
